package main

const (
	ZERO = '0'
	NiNE = '9'
	ADD = '+'
	DEL = '-'
	CHEN = '*'
	CHU = '/'
)
/*func main()  {
	var str = "13+2*33/3*8-6"

	op := '+'
	num := 0
	var stack []int
	for i,v := range str{
		if v >= ZERO && v <= NiNE {
			num = 10*num + int(v-ZERO)
		}
		if i == len(str)-1 || v == ADD || v == DEL || v == CHEN || v == CHU {

			switch op {
			case ADD:
				stack = append(stack, num)
			case DEL:
				stack = append(stack, -num)
			case CHEN:
				stack[len(stack)-1] *= num
			case CHU:
				stack[len(stack)-1] /= num
			}
			num = 0
			op = v
		}
	}


	ret := 0
	for _,v := range stack {
		ret += v
	}
	fmt.Println(stack)
	fmt.Println(ret)
}*/

func calData(str string) int  {

	op := '+'
	num := 0
	var stack []int
	for i,v := range str{
		if v >= ZERO && v <= NiNE {
			num = 10*num + int(v-ZERO)
		}
		if i == len(str)-1 || v == ADD || v == DEL || v == CHEN || v == CHU {

			switch op {
			case ADD:
				stack = append(stack, num)
			case DEL:
				stack = append(stack, -num)
			case CHEN:
				stack[len(stack)-1] *= num
			case CHU:
				stack[len(stack)-1] /= num
			}
			num = 0
			op = v
		}
	}


	ret := 0
	for _,v := range stack {
		ret += v
	}
	return  ret
}
